.class final Lcom/greystripe/sdk/bj;
.super Ljava/lang/Object;


# static fields
.field private static a:Ljava/lang/String;

.field private static b:Ljava/lang/String;

.field private static c:Ljava/util/Map;

.field private static d:Landroid/content/SharedPreferences;

.field private static final e:Ljava/util/Set;

.field private static final f:Ljava/util/Set;

.field private static g:Z

.field private static h:Lcom/greystripe/sdk/bl;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    const-string v0, "com.greystripe.settings.providers"

    sput-object v0, Lcom/greystripe/sdk/bj;->a:Ljava/lang/String;

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v1, Lcom/greystripe/sdk/bj;->a:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ".SettingsContentProvider"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/greystripe/sdk/bj;->b:Ljava/lang/String;

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    const/4 v0, 0x0

    sput-boolean v0, Lcom/greystripe/sdk/bj;->g:Z

    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    sput-object v0, Lcom/greystripe/sdk/bj;->e:Ljava/util/Set;

    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    sput-object v0, Lcom/greystripe/sdk/bj;->f:Ljava/util/Set;

    sget-object v0, Lcom/greystripe/sdk/bj;->e:Ljava/util/Set;

    sget-object v1, Lcom/greystripe/sdk/bk;->GUID:Lcom/greystripe/sdk/bk;

    invoke-interface {v0, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    sget-object v0, Lcom/greystripe/sdk/bj;->f:Ljava/util/Set;

    sget-object v1, Lcom/greystripe/sdk/bk;->GUID:Lcom/greystripe/sdk/bk;

    invoke-interface {v0, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    sget-object v0, Lcom/greystripe/sdk/bj;->f:Ljava/util/Set;

    sget-object v1, Lcom/greystripe/sdk/bk;->AD_SERVER_URL:Lcom/greystripe/sdk/bk;

    invoke-interface {v0, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    const/4 v0, 0x0

    sput-object v0, Lcom/greystripe/sdk/bj;->h:Lcom/greystripe/sdk/bl;

    return-void
.end method

.method static a()Lcom/greystripe/sdk/bl;
    .locals 2

    sget-object v0, Lcom/greystripe/sdk/bj;->h:Lcom/greystripe/sdk/bl;

    if-nez v0, :cond_0

    new-instance v0, Lcom/greystripe/sdk/bl;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/greystripe/sdk/bl;-><init>(B)V

    sput-object v0, Lcom/greystripe/sdk/bj;->h:Lcom/greystripe/sdk/bl;

    :cond_0
    sget-object v0, Lcom/greystripe/sdk/bj;->h:Lcom/greystripe/sdk/bl;

    return-object v0
.end method

.method static a(Lcom/greystripe/sdk/bk;)Ljava/lang/String;
    .locals 1

    invoke-virtual {p0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static a(Landroid/content/Context;)V
    .locals 2

    sget-boolean v0, Lcom/greystripe/sdk/bj;->g:Z

    if-nez v0, :cond_0

    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "gs_preferences_"

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-static {}, Lcom/greystripe/sdk/GSSdkInfo;->getVersion()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    sput-object v0, Lcom/greystripe/sdk/bj;->d:Landroid/content/SharedPreferences;

    invoke-static {p0}, Lcom/greystripe/sdk/bj;->c(Landroid/content/Context;)V

    const/4 v0, 0x1

    sput-boolean v0, Lcom/greystripe/sdk/bj;->g:Z

    :cond_0
    return-void
.end method

.method static a(Ljava/lang/String;)V
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bk;->GUID:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0, p0}, Lcom/greystripe/sdk/bj;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method static a(Ljava/lang/String;Ljava/lang/String;)V
    .locals 1

    if-eqz p1, :cond_0

    invoke-static {p0}, Lcom/greystripe/sdk/bj;->f(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, p0, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :cond_0
    return-void
.end method

.method static b()Ljava/lang/String;
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bk;->GUID:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static b(Ljava/lang/String;)V
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bk;->AD_SERVER_URL:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0, p0}, Lcom/greystripe/sdk/bj;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method private static b(Landroid/content/Context;)Z
    .locals 6

    const/4 v0, 0x0

    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    sget-object v2, Lcom/greystripe/sdk/bj;->a:Ljava/lang/String;

    const/16 v3, 0x8

    invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object v1

    iget-object v2, v1, Landroid/content/pm/PackageInfo;->providers:[Landroid/content/pm/ProviderInfo;

    if-eqz v2, :cond_0

    array-length v3, v2

    move v1, v0

    :goto_0
    if-ge v1, v3, :cond_0

    aget-object v4, v2, v1

    iget-object v4, v4, Landroid/content/pm/ProviderInfo;->authority:Ljava/lang/String;

    sget-object v5, Lcom/greystripe/sdk/bj;->b:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-eqz v4, :cond_1

    const/4 v0, 0x1

    :cond_0
    :goto_1
    return v0

    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :catch_0
    move-exception v1

    goto :goto_1
.end method

.method static b(Lcom/greystripe/sdk/bk;)Z
    .locals 1

    invoke-virtual {p0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->d(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method static c()Ljava/lang/String;
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bk;->AD_SERVER_URL:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static c(Ljava/lang/String;)Ljava/lang/String;
    .locals 2

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    :goto_0
    return-object v0

    :cond_0
    sget-object v0, Lcom/greystripe/sdk/bj;->d:Landroid/content/SharedPreferences;

    const/4 v1, 0x0

    invoke-interface {v0, p0, v1}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method private static c(Landroid/content/Context;)V
    .locals 7

    const/4 v6, 0x0

    invoke-static {p0}, Lcom/greystripe/sdk/bj;->b(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    const/4 v0, 0x3

    new-array v2, v0, [Ljava/lang/String;

    const/4 v0, 0x0

    const-string v1, "_id"

    aput-object v1, v2, v0

    const/4 v0, 0x1

    const-string v1, "key"

    aput-object v1, v2, v0

    const/4 v0, 0x2

    const-string v1, "value"

    aput-object v1, v2, v0

    :try_start_0
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "content://"

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    sget-object v1, Lcom/greystripe/sdk/bj;->b:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "/settings"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v1

    if-nez v1, :cond_2

    if-eqz v1, :cond_0

    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    goto :goto_0

    :cond_2
    :try_start_1
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v0

    if-eqz v0, :cond_5

    const-string v0, "key"

    invoke-interface {v1, v0}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v0

    const-string v2, "value"

    invoke-interface {v1, v2}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v2

    :cond_3
    invoke-interface {v1, v0}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v4

    invoke-static {v3}, Lcom/greystripe/sdk/bj;->g(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_4

    invoke-static {v3, v4}, Lcom/greystripe/sdk/bj;->a(Ljava/lang/String;Ljava/lang/String;)V

    :cond_4
    invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    move-result v3

    if-nez v3, :cond_3

    :cond_5
    if-eqz v1, :cond_0

    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    goto :goto_0

    :catchall_0
    move-exception v0

    move-object v1, v6

    :goto_1
    if-eqz v1, :cond_6

    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    :cond_6
    throw v0

    :catchall_1
    move-exception v0

    goto :goto_1
.end method

.method static d()J
    .locals 2

    sget-object v0, Lcom/greystripe/sdk/bk;->AD_READY_TIME:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->e(Ljava/lang/String;)J

    move-result-wide v0

    return-wide v0
.end method

.method static d(Ljava/lang/String;)Z
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    sget-object v0, Lcom/greystripe/sdk/bj;->d:Landroid/content/SharedPreferences;

    invoke-interface {v0, p0}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method static e()J
    .locals 2

    sget-object v0, Lcom/greystripe/sdk/bk;->AD_LOAD_TIME:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->e(Ljava/lang/String;)J

    move-result-wide v0

    return-wide v0
.end method

.method private static e(Ljava/lang/String;)J
    .locals 2

    invoke-static {p0}, Lcom/greystripe/sdk/bj;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_0

    const-wide/16 v0, 0x7530

    :goto_0
    return-wide v0

    :cond_0
    invoke-static {v0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v0

    goto :goto_0
.end method

.method static f()V
    .locals 3

    sget-object v0, Lcom/greystripe/sdk/bk;->STOP_REQUESTING_ADS_ALWAYS_AND_FOREVER:Lcom/greystripe/sdk/bk;

    const-string v1, "true"

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bj;->a(Ljava/lang/String;Ljava/lang/String;)V

    sget-object v0, Lcom/greystripe/sdk/bk;->STOP_REQUESTING_ADS_ALWAYS_AND_FOREVER:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v1

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    sget-object v0, Lcom/greystripe/sdk/bj;->d:Landroid/content/SharedPreferences;

    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-interface {v2, v1, v0}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    sget-object v0, Lcom/greystripe/sdk/bj;->c:Ljava/util/Map;

    invoke-interface {v0, v1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    :cond_0
    return-void
.end method

.method private static f(Ljava/lang/String;)Z
    .locals 2

    :try_start_0
    invoke-static {p0}, Lcom/greystripe/sdk/bk;->valueOf(Ljava/lang/String;)Lcom/greystripe/sdk/bk;

    move-result-object v0

    sget-object v1, Lcom/greystripe/sdk/bj;->e:Ljava/util/Set;

    invoke-interface {v1, v0}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->d(Ljava/lang/String;)Z
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :catch_0
    move-exception v0

    :cond_0
    const/4 v0, 0x1

    goto :goto_0
.end method

.method static g()Z
    .locals 1

    sget-object v0, Lcom/greystripe/sdk/bk;->STOP_REQUESTING_ADS_ALWAYS_AND_FOREVER:Lcom/greystripe/sdk/bk;

    invoke-virtual {v0}, Lcom/greystripe/sdk/bk;->name()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/greystripe/sdk/bj;->d(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method private static g(Ljava/lang/String;)Z
    .locals 2

    :try_start_0
    invoke-static {p0}, Lcom/greystripe/sdk/bk;->valueOf(Ljava/lang/String;)Lcom/greystripe/sdk/bk;

    move-result-object v0

    sget-object v1, Lcom/greystripe/sdk/bj;->f:Ljava/util/Set;

    invoke-interface {v1, v0}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :catch_0
    move-exception v0

    :cond_0
    invoke-static {p0}, Lcom/greystripe/sdk/bj;->f(Ljava/lang/String;)Z

    move-result v0

    goto :goto_0
.end method
